function makeCenter(id) {
   var obj = $('#' + id);
   var topMargin = (obj.parent().height() - obj.height()) / 2;
   var leftMargin = (obj.parent().width() - obj.width()) / 2;
   obj.css('margin-top', topMargin);
   obj.css('margin-left', leftMargin);
}

function makeCenter2(id) {
   var obj = $('#' + id);
   var position = obj.position();
   var topMargin = position.top + (obj.parent().height() - obj.height()) / 2;
   var leftMargin = position.left + (obj.parent().width() - obj.width()) / 2;
   obj.css('top', topMargin);
   obj.css('left', leftMargin);
}